home *** CD-ROM | disk | FTP | other *** search
- Path: fred.net!news
- From: bitmask@bigdog.fred.net (Scott Allen)
- Newsgroups: comp.lang.c
- Subject: Re: A Simple Question From A Beginner (Please Help)
- Date: Tue, 19 Mar 1996 13:31:56 GMT
- Organization: FredNet - Frederick, Md.
- Message-ID: <314eb48a.997688@news.fred.net>
- References: <4i26gm$6th@news.bellglobal.com>
- NNTP-Posting-Host: bitmask.fred.net
- X-Newsreader: Forte Agent .99d/32.168
-
- dlowe@pathcom.com (David Lowe) wrote:
-
- >
- >This should be a simple thing to execute but for some reason I can not
- >get it to work.
- >
- >
- >What I would like to do is execute something like a SHELL command.
- >What I would like to do in C or C++ is the equivelent to typing the
- >following at the Win NT command line:
- >
- >
- > sendmail dlowe@pathcom.com < mail.txt
- >
- >I have tried the following code:
- >
- > _spawnl( _P_WAIT, "sendmail.exe", "dlowe@pathcom.com < mail.txt",
- > NULL);
-
- Dave,
-
- Remember in spanwl you need to pass the
- mode, path, and arg0 before you pass
- any of the other command line arguments.
- So perhaps it should look more like this :
-
- spawnl(P_WAIT, "sendmail.exe", "sendmail.exe", arg1, NULL );
-
- You might want to check the return value against ENOENT
- to see if the program/path not found. I'm not sure how
- your specific implementation works, you might need to
- give the specific path to sendmail. Perhaps using
- the searchpath function (in BC++ anyway).
-
- Hopwe this helps,
- --
- Scott Allen
- bitmask@bigdog.fred.net
- Hagerstown, MD USA
-